package common;

import java.util.ArrayList;
import java.util.Collection;

import common.IPredicate;

public class Filter<T> {

	public static <T> Collection<T> filter(Collection<T> target, IPredicate<T> predicate) {
	    Collection<T> result = new ArrayList<T>();
	    for (T element: target) {
	        if (predicate.apply(element)) {
	            result.add(element);
	        }
	    }
	    return result;
	}

}
